package Eyjafjalla.action;

import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.actions.common.DiscardAction;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;

public class PulseAction extends AbstractGameAction {
    public PulseAction(AbstractCreature target, DamageInfo info, int block, int magic){
        this.target = target;
        this.info = info;
        this.block = block;
        this.magic = magic;
    }

    DamageInfo info;
    int block;
    int magic;

    @Override
    public void update() {

        for(AbstractCard c: AbstractDungeon.player.hand.group){
            if(c.type== AbstractCard.CardType.ATTACK){
                addToTop(new DamageAction(target,info,AttackEffect.FIRE));
            }
            else if(c.type== AbstractCard.CardType.SKILL){
                addToTop(new GainBlockAction(info.owner,block));
            }
            else{
                addToTop(new DrawCardAction(magic));
            }
        }

        addToTop(new DiscardAction(info.owner,info.owner,10,true));

        this.isDone = true;
    }
}
